package net.zjitc.controller;

import com.sun.org.glassfish.gmbal.ParameterNames;
import net.zjitc.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class UserController {
    @RequestMapping(value = "/loginUI")
    public String loginUI(){
        return "login";
    }
    /*参数绑定*/
    /*@RequestMapping(value = "/login")
    public String login(@RequestParam(name = "username") String name,
                        @RequestParam(name = "password") String pass,
                        Model model){
        System.out.println("------------");
        System.out.println(name);
        System.out.println(pass);
        model.addAttribute("msg","登录成功！");
        return "message";
    }*/
    @RequestMapping(value = "/login")
    public String login(User user,
                        Model model){
        System.out.println("------------");
        System.out.println(user.getPassword());
        System.out.println(user.getUsername());
        model.addAttribute("msg","登录成功！");
        return "message";
    }


    @RequestMapping(value = "/registerui")
    public String registerui(){
        return "register";
    }

}
